<template>
  <router-view class="router-view"
               v-slot="{ Component }">
    <transition>
      <component :is="Component" />
    </transition>
  </router-view>
</template>

<script >
import { watch, computed } from 'vue'
import { useStore } from 'vuex'
export default {
  setup () {
    const store = useStore()
    const token = computed(() => store.getters.token)
    watch(token, (val, oldval) => {
      console.log(val, oldval)
      val && store.dispatch('app/getShopCartNums')
    }, { immediate: true })
    return {
      token
    }
  }
}

</script>

<style lang="less">
html,
body {
  overflow-y: auto;
  padding: 0 !important;
}

#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
</style>